﻿using Microsoft.Practices.Unity;
using Sasa.QualityTools.CodeAnalysis.Common;
using Sasa.QualityTools.CodeAnalysis.Core.VisualStudio;
using Sasa.QualityTools.CodeAnalysis.FxCopIntegrator.Views;
using Sasa.QualityTools.CodeAnalysis.FxCopIntegrator.ViewModels;
using Sasa.QualityTools.CodeAnalysis.FxCopIntegrator.Commands.Behaviors;

namespace Sasa.QualityTools.CodeAnalysis.FxCopIntegrator.Commands
{
    [MenuCommand(Constants.RuleDetailWindowPane.Id, Constants.RuleDetailWindowPane.ShowMoreDetail)]
    public class ShowMoreRuleDetailCommand : CommandBase<CommandExecutionContext>, ICommandBehavior<CommandExecutionContext>
    {
        public ShowMoreRuleDetailCommand(IUnityContainer container)
            : base(container)
        {
            Behaviors.Add(this);
        }


        public void Behave(CommandExecutionContext context)
        {
            var ide = Container.Resolve<IIde>();
            var view = ide.FindRuleDetailView();
            var model = (RuleDetailViewModel)view.DataContext;
            model.ShowMoreDetail();
        }
    }
}
